package com.xiaoshuidi.cloud.module.rooms.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoshuidi.cloud.module.rooms.mapper.RoomDevicePeakValleyPriceMapper;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomDevicePeakValleyPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @BelongsProject: lease-module-rooms
 * @BelongsPackage: com.xiaoshuidi.cloud.module.rooms.repository
 * @Author: Jax
 * @CreateTime: 2024-08-16
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class IotRoomDevicePeakValleyPriceRepository extends ServiceImpl<RoomDevicePeakValleyPriceMapper, RoomDevicePeakValleyPrice> {

    @Autowired
    RoomDevicePeakValleyPriceMapper roomDevicePeakValleyPriceMapper;

    /**
     * 根据 room_device_id 删除
     * @param priceId
     * @return
     */
    public int deleteByPriceId(Long priceId) {
        LambdaQueryWrapper<RoomDevicePeakValleyPrice> wrapper = new LambdaQueryWrapper();
        wrapper.eq(RoomDevicePeakValleyPrice::getRoomDeviceId, priceId);
        return roomDevicePeakValleyPriceMapper.delete(wrapper);
    }
}
